<%@ page contentType="text/html;charset=UTF-8"%>
<!doctype html>
<html>
<head>
<title>欢迎您！用户登录</title>
<jsp:include flush="true" page="include.jsp"></jsp:include>
<script type="text/javascript">
$(function(){
	
	$("<div id='div_brg0001'>数据提交中......</div>").css({
		position:'absolute',
		top:0,
		left:0,
		backgroundColor:"#004400",
		opacity:0.1,
		zIndex:300
		})
		.height($(document).height())
		.width($(document).width()).hide().appendTo("body")

    $('#kaptchaImage').click(function () {   
        $(this).attr('src', 'validate.code?' + Math.floor(Math.random()*100) ); 
    })
	/*
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#center").height();
	var popupWidth = $("#center").width();
	$("#center").css({
	    "position": "absolute",
	    "top": windowHeight/2-popupHeight/2,
	    "left": windowWidth/2-popupWidth/2
	});*/
	
	/*
	$('#ff').form({
		url:'${home}/login.do',
		success:function(data){
			data = $.parseJSON(data);
			//data = eval(data);
			if(data.code==0) {
				window.location="${home}/jsp/index.jsp";
			}else{
				//$('.datagrid-mask').unmask();
				alert(data.text);
			}
		},
        onSubmit: function(){
        	//alert(1);
        	//$('.datagrid-mask').mask('数据加载中......');
        	//return true;
            // do some check
            // return false to prevent submit;
   		}
	});*/
	
	$("#p").click(function (){ 
		submit();
	});
	
    $("body").bind('keyup',function(event) {  
    	if(event.keyCode==13){  
    		submit(); 
    	}     
    }); 

    function submit(){
    	$.blockUI();
		var loginName=$("#loginName").val();
		var pwd=$("#pwd").val();
		var code=$("#code").val();
		
		$.post("${home}/login.do",{loginName:loginName,pwd:pwd,code:code},
	   		function(data){
				$.unblockUI();
	    		if(data.code==0) {
	    			window.location="${home}/jsp/index.jsp";
	    		}else{
	    			//$('.datagrid-mask').unmask();
	    			alert(data.text);
	    		}
	    });
    }
			
})
//
</script>
<style type="text/css">
table tr {
	height: 35px;
}

.btn {

}
</style>
</head>
<body style="background-color: #ccc">
<form id="ff" method="post">
	<div id="center" style="position:absolute;left:50%;top:50%;margin-top:-150px;margin-left:-200px;">
		<div class="easyui-panel" data-options="tools:'#tt'" title="用户登录" style="width: 400px;">

			
			<div style="padding: 10px 0 10px 60px">
				
					<table>
						<tr>
							<td>用户名:</td>
							<td><input type="text" id="loginName"></input></td>
						</tr>
						<tr>
							<td>密  码:</td>
							<td><input type="password" id="pwd"></input></td>
						</tr>
						<tr>
							<td>验证码:</td>
							<td align="center" vertical-align:middle="middle"><input type="text" id="code" size="8"></input>
							<img id="kaptchaImage" title="看不清?点击换一张" src="validate.code" style="cursor: pointer;"/>
							</td>
						</tr>
						<tr>
							<td></td>
							<td><input type="checkbox" name="subject">记住我</input></td>
						</tr>					
					</table>
				
			</div>
			<div style="text-align:center;padding:5px">
				<button type="button" id="p" class="btn">登录</button>
	        </div>
	        
		</div>
	</div>
</form>
	<div id="tt">
		<a href="javascript:void(0)" class="icon-help" onclick="javascript:alert('help')"></a>
	</div>
</body>

</html>